package com.sw.study.email.controller;

import com.sw.study.email.util.MailUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/email")
public class EmailController {

    //⽣成验证码并发送到对应邮箱，成功
    //true，失败false
    @GetMapping("/{email}/{code}")
    public Boolean createEmail(@PathVariable String email,@PathVariable String code) throws Exception{
        MailUtil.sendMail(email,code);
        return true;
    }
}
